<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
		    <li><a href="{:url('cloud/index')}">个人信息</a></li>
            <li><a href="{:url('cloud/goodsindex')}">商品列表</a></li>
            <li class="active"><a href="###">仓库列表</a></li>
            <li><a href="{:url('cloud/logs')}">余额明细</a></li>
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('cloud/storaindex')}">
            名称：
            <input class="form-control" type="text" name="keyword" value="{:input('keyword')}" placeholder="请输入仓库名称">
			<input type="submit" class="btn btn-primary" value="搜索">
			<a class="btn btn-danger" href="{:url('cloud/storaindex')}">清空</a>
		</form>
		<div class="well form-inline margin-top-20">
		    <a class="btn btn-danger" onclick="set()" href="###">批量改价</a>
		</div>
		<form method="post" class="js-ajax-form">
			<div class="row">
				<table class="table table-hover table-bordered table-striped table-condensed">
					<thead>
					<tr>
					    <th><input type="checkbox" id="allSelected" /></th>
						<th>ID</th>
						<th>名称</th>
						<th>快递名称</th>
						<th>快递价格</th>
						<th>成本价</th>
						<th>淘宝</th>
						<th>阿里</th>
						<th>京东</th>
						<th>拼多多</th>
						<th>抖音</th>
						<th>其他</th>
						<th>地区</th>
						<th>详细地址</th>
						<th>{:lang('ACTIONS')}</th>
					</tr>
					</thead>
					<tbody>
					<foreach name="list" item="vo">
						<tr>
						    <td><input type="checkbox" name="ids" id="" value="{$vo.id}" /></td>
							<td>{$vo.id}</td>
							<td>{$vo.name}</td>
							<td>{$vo.deliver_name}</td>
							<td>{$vo.deliver_price}</td>
							<td>{$vo.deliver_cost_price}</td>
							<td>{$vo.tb_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.ali_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.jd_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.pinxixi_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.dy_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.others_switch == 1 ? '<span style="color:green;">是</span>' : '否'}</td>
							<td>{$vo.city}</td>
							<td>{$vo.detailed_address}</td>
							<td>
								
							</td>
						</tr>
					</foreach>
					</tbody>
				</table>
				<div class="pagination">{$list->render()}</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script src="__STATIC__/layui/dist/layui.js"></script>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	<script type="text/javascript" charset="utf-8">
	    layui.use('form', function(){
            var layer = layui.layer;
        });
        $("#allSelected").bind('click', function() {
            if (!$(this).attr('checked')) {
                $(this).attr('checked', true);
                $("input[name='ids']").prop('checked', true);
            } else {
                $(this).removeAttr('checked');
                $("input[name='ids']").prop('checked', false);
            }
	    })
	    function set() {
	        var checkbox = $("input[name='ids']");
	        var dat = []
	        for (var i = 0; i < checkbox.length; i ++) {
	            if ($(checkbox[i]).prop('checked')) {
	                dat.push($(checkbox[i]).val())
	            }
	        }
	        if (dat.length <= 0) {
	            layer.msg('请选择要操作的数据', {shift: 6})
	            return false;
	        }
	        layer.prompt({title: '请输入价格', formType: 3}, function(price, index) {
	            if (price <= 0) {
	                layer.msg('价格错误', {shift: 6})
	                return false;
	            }
	            $.post("{:url('cloud/batchSetStoraPrice')}", {ids: dat, price: price}, function(res) {
    	            if (res.code == 1) {
    	                layer.alert(res.msg, function() {
    	                    window.location.reload()
    	                })
    	            } else {
    	                layer.msg(res.msg, {icon: 5})
    	            }
    	        })
	        })
	    }
	</script>
</body>
</html>